package com.sqx.modules.app.controller.app;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.app.entity.UserMoneyDetails;
import com.sqx.modules.app.service.UserMoneyDetailsService;
import com.sqx.modules.app.service.UserMoneyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

@RestController
@AllArgsConstructor
@RequestMapping("/app/userMoney")
@Api(value = "app 钱包", tags = {"app 钱包"})
public class AppUserMoneyController {
    @Autowired
    private UserMoneyService userMoneyService;
    @Autowired
    private UserMoneyDetailsService userMoneyDetailsService;

    @GetMapping("/selectMyMoney")
    @Login
    @ApiOperation("我的钱包余额")
    public Result selectMyMoney(@RequestAttribute Long userId) {
        return Result.success().put("data", userMoneyService.selectUserMoneyByUserId(userId));
    }

    @Login
    @ApiOperation("钱包明细")
    @GetMapping("/queryUserMoneyDetails")
    public Result queryUserMoneyDetails(Integer page, Integer limit, @RequestAttribute("userId") Long userId, UserMoneyDetails userMoneyDetails) {
        userMoneyDetails.setUserId(userId);
        return userMoneyDetailsService.queryUserMoneyDetails(page, limit, userMoneyDetails);
    }

    @Login
    @ApiOperation("钱包明细")
    @GetMapping("/selectUserMoneyDetails")
    public Result selectUserMoneyDetails(Integer page, Integer limit, @RequestAttribute("userId") Long userId,Integer classify) {
        return userMoneyDetailsService.selectUserMoneyDetails(page, limit, userId,classify);
    }


}
